package com.sc.service.member;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sc.dal.dto.member.AgentDto;
import com.sc.dal.mapper.member.MemberMapper;
import com.sc.dal.model.ParamMap;
import com.sc.dal.model.member.Member;


/**
 * 
 * <h1>用户的业务逻辑层</h1> 
 * 
 * @author xujunbao 
 * @version MemberService.java,v0.1 2017年3月3日 下午2:02:51 xujunbao Exp  
 *
 */
@Service
public class MemberService {
	/**引入用户的mapper层*/
	@Autowired
	private MemberMapper memberMapper;
	public  Member selectBymName(String mName){
		return memberMapper.selectBymName(mName);
	}
	public Member selectByPhone(String mPhone) {
		// TODO Auto-generated method stub
		List<Member> list=memberMapper.selectByPhone(mPhone);
		if(list!=null&&list.size()>0){
			return list.get(0);
		}
		return null;
	}
	
	public AgentDto selectAgentDtoByPhone(String mPhone){
		List<AgentDto> list=memberMapper.selectAgentDtoByPhone(mPhone);
		if(list!=null && list.size()>0){
			return list.get(0);
		}else{
			return null;
		}
	}
	public int insertSelective(Member member){
		
		return memberMapper.insertSelective(member);
	}
	public Member selectByPrimaryKey(String mId){
		return memberMapper.selectByPrimaryKey(mId);
	}
	public int updateByPrimaryKeySelective(Member member){
		return memberMapper.updateByPrimaryKeySelective(member);
	}
	public List<Member> selectList(ParamMap paramMap) {
		return memberMapper.selectList(paramMap);
	}
	public List<Member> selectMemberList(ParamMap paramMap) {
		return memberMapper.selectMemberList(paramMap);
	}
	public void deleteByPrimaryKey(String mId){
		memberMapper.deleteByPrimaryKey(mId);
	}
	//通过会员ID查询代理等级和折扣率
	public Map<String,Object> selectAgentInfoByMemberId(String mId){
		return memberMapper.selectAgentInfoByMemberId(mId);
	}
}
